/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TelaPedidos.java
 *
 * Created on 25/06/2010, 20:05:35
 */

package br.com.pi.SmartFast.view;

import br.com.pi.SmartFast.controler.ControleTelaCardapio;
import br.com.pi.SmartFast.controler.ControleTelaPedidos;

/**
 *
 * @author Administrador
 */
public class TelaPedidos extends javax.swing.JFrame {
    ControleTelaPedidos cp;
    public static int opcao = 0;

    /** Creates new form TelaPedidos */
    public TelaPedidos() {
        initComponents();

        cp = new ControleTelaPedidos(jLRecebeTotal, jTable1,this);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        botaoGarcon = new javax.swing.JButton();
        botaoFecharConta = new javax.swing.JButton();
        botaoPedidos = new javax.swing.JButton();
        botaoSobremesas = new javax.swing.JButton();
        botaoBebidas = new javax.swing.JButton();
        botaoRefeicoes = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jLTotal = new javax.swing.JLabel();
        jLRecebeTotal = new javax.swing.JLabel();
        jBExcluirPedido = new javax.swing.JButton();
        jBEnviarPedido = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setUndecorated(true);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        botaoGarcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgGarcon.png"))); // NOI18N
        botaoGarcon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoGarconActionPerformed(evt);
            }
        });

        botaoFecharConta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgFecharConta.png"))); // NOI18N
        botaoFecharConta.setEnabled(false);
        botaoFecharConta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoFecharContaActionPerformed(evt);
            }
        });

        botaoPedidos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgPedidos2.png"))); // NOI18N

        botaoSobremesas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgSobremesas.png"))); // NOI18N
        botaoSobremesas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoSobremesasActionPerformed(evt);
            }
        });

        botaoBebidas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgBebidas.png"))); // NOI18N
        botaoBebidas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoBebidasActionPerformed(evt);
            }
        });

        botaoRefeicoes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgRefeicoes.png"))); // NOI18N
        botaoRefeicoes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoRefeicoesActionPerformed(evt);
            }
        });

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        jLTotal.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLTotal.setText("TOTAL = R$");

        jLRecebeTotal.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLRecebeTotal.setText("000,00");

        jBExcluirPedido.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgExcluirDoPedido.png"))); // NOI18N
        jBExcluirPedido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBExcluirPedidoActionPerformed(evt);
            }
        });

        jBEnviarPedido.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/pi/SmartFast/imagens/imgEnviarPedido.png"))); // NOI18N
        jBEnviarPedido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBEnviarPedidoActionPerformed(evt);
            }
        });

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "PRODUTOS", "QTD", "VALOR"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setColumnSelectionAllowed(true);
        jTable1.setShowHorizontalLines(false);
        jTable1.setShowVerticalLines(false);
        jTable1.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(botaoRefeicoes, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                        .addGap(163, 163, 163)
                        .addComponent(botaoBebidas, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                        .addGap(154, 154, 154)
                        .addComponent(botaoSobremesas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 593, Short.MAX_VALUE)
                        .addGap(39, 39, 39)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(52, 52, 52)
                                .addComponent(jLTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLRecebeTotal, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                                .addGap(66, 66, 66))
                            .addComponent(jBEnviarPedido, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                            .addComponent(jBExcluirPedido, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(botaoPedidos, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                        .addGap(263, 263, 263)
                        .addComponent(botaoFecharConta, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                        .addGap(258, 258, 258)
                        .addComponent(botaoGarcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(botaoBebidas)
                                    .addComponent(botaoSobremesas)
                                    .addComponent(botaoRefeicoes))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(47, 47, 47)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLTotal)
                                            .addComponent(jLRecebeTotal))
                                        .addGap(40, 40, 40)
                                        .addComponent(jBExcluirPedido)
                                        .addGap(47, 47, 47)
                                        .addComponent(jBEnviarPedido)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 280, Short.MAX_VALUE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 497, Short.MAX_VALUE))))
                            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 498, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(101, 101, 101))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(botaoFecharConta)
                            .addComponent(botaoPedidos)
                            .addComponent(botaoGarcon))
                        .addContainerGap())))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botaoFecharContaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoFecharContaActionPerformed
        new TelaFecharConta().setVisible(true);
}//GEN-LAST:event_botaoFecharContaActionPerformed

    private void botaoSobremesasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoSobremesasActionPerformed
       new TelaBebidas().setVisible(true);
       opcao = 2;
}//GEN-LAST:event_botaoSobremesasActionPerformed

    private void botaoBebidasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoBebidasActionPerformed
        new TelaBebidas().setVisible(true);
        opcao = 3;
}//GEN-LAST:event_botaoBebidasActionPerformed

    private void botaoRefeicoesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoRefeicoesActionPerformed
        new TelaBebidas().setVisible(true);
        opcao = 1;
}//GEN-LAST:event_botaoRefeicoesActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        cp.aoAbrirTelaPedidos();
    }//GEN-LAST:event_formWindowOpened

    private void botaoGarconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoGarconActionPerformed
        new ControleTelaCardapio().ajudaGarcom();
    }//GEN-LAST:event_botaoGarconActionPerformed

    private void jBEnviarPedidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBEnviarPedidoActionPerformed
        cp.enviarPedido();
    }//GEN-LAST:event_jBEnviarPedidoActionPerformed

    private void jBExcluirPedidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBExcluirPedidoActionPerformed
        cp.excluirItemDoPedido();
    }//GEN-LAST:event_jBExcluirPedidoActionPerformed

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated

        cp.aoAbrirTelaPedidos();
        
    }//GEN-LAST:event_formWindowActivated

    /**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new TelaPedidos().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botaoBebidas;
    private javax.swing.JButton botaoFecharConta;
    private javax.swing.JButton botaoGarcon;
    private javax.swing.JButton botaoPedidos;
    private javax.swing.JButton botaoRefeicoes;
    private javax.swing.JButton botaoSobremesas;
    private javax.swing.JButton jBEnviarPedido;
    private javax.swing.JButton jBExcluirPedido;
    private javax.swing.JLabel jLRecebeTotal;
    private javax.swing.JLabel jLTotal;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables

}
